package io.r2mo.test.common.controller.gen.order;

import io.r2mo.test.common.service.gen.order.IOrderServiceV1;
import io.r2mo.test.common.domain.OrderEntity;
import io.r2mo.spring.common.webflow.BaseController;
import io.r2mo.typed.common.Pagination;
import io.r2mo.typed.json.JObject;
import io.r2mo.typed.webflow.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * Order Controller接口
 * </p>
 *
 * @author lang
 * @since 2025-09-22
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/v1/order")
public class OrderCrudControllerV1 extends BaseController<OrderEntity, OrderCommonRequest, OrderCommonResponse> implements OrderCrudController {

    @Autowired
    private IOrderServiceV1 service;

    @Override
    protected IOrderServiceV1 service() {
        return this.service;
    }

    @Override
    protected OrderCommonResponse createResponse() {
        return new OrderCommonResponse();
    }

    @Override
    protected OrderCommonRequest createRequest() {
        return new OrderCommonRequest();
    }

    // POST /v1/order
    @Override
    public R<OrderCommonResponse> createSingle(final OrderCommonRequest request) {
        return super.createSingle(request);
    }

    // PUT /v1/order/{id}
    @Override
    public R<OrderCommonResponse> updateSingle(final String id, final OrderCommonRequest request) {
        return super.updateSingle(id, request);
    }

    // GET /v1/order/{id}
    @Override
    public R<OrderEntity> findSingle(final String id) {
        return super.findSingle(id);
    }

    // DELETE /v1/order/{id}
    @Override
    public R<Boolean> removeSingle(final String id) {
        return super.removeSingle(id);
    }

    // POST /v1/order/search
    @Override
    public R<Pagination<OrderEntity>> findPage(final JObject query) {
        return super.findPage(query);
    }

    // GET /v1/order/all
    @Override
    public R<List<OrderEntity>> findAll() {
        return super.findAll();
    }

    // POST /v1/order/import
    @Override
    public R<Boolean> uploadData(final MultipartFile file, final JObject config) {
        return super.uploadData(file, config);
    }

    // POST /v1/order/export
    @Override
    public void downloadBy(final JObject query) {
        super.downloadBy(query);
    }
}